function changerModelHigth(a) {
		var grid = a.items.get(0);
		grid.setHeight(a.getHeight()-a.tbar.dom.clientHeight);
		a.on('resize',function(n,adjWidth,adjHeight,rawWidth,rawHeight){
			grid.setHeight(a.getHeight()-a.tbar.dom.clientHeight);
		});
}

function changerReportModelHigth(a) {
		var grid = a.items.get(0);
		var panel = a.items.get(1);
		grid.setHeight(a.getHeight()-a.tbar.dom.clientHeight-a.bbar.dom.clientHeight);
		panel.setHeight(a.getHeight()-a.tbar.dom.clientHeight-a.bbar.dom.clientHeight);
		a.on('resize',function(n,adjWidth,adjHeight,rawWidth,rawHeight){
			grid.setHeight(a.getHeight()-a.tbar.dom.clientHeight-a.bbar.dom.clientHeight);
			panel.setHeight(a.getHeight()-a.tbar.dom.clientHeight-a.bbar.dom.clientHeight);
		});
}

function higthFeeAfterLoder(a) {
		var grid = a.items.get(1);
		var form = a.items.get(0);
		form.collapse(false);
		grid.setHeight(a.getHeight()-a.tbar.dom.clientHeight-1);
		a.on('resize',function(n,adjWidth,adjHeight,rawWidth,rawHeight){
			if(form.collapsed)
				grid.setHeight(a.getHeight()-a.tbar.dom.clientHeight-1);
			else
				grid.setHeight(a.getHeight()-a.tbar.dom.clientHeight-form.getHeight());
		});
}
function higthFeeChartAfterLoder(a) {
		var grid = a.items.get(2);
		var form = a.items.get(0);
		var charP =  a.items.get(1);
		form.collapse(false);
		grid.setHeight(a.getHeight()-charP.getHeight()-a.tbar.dom.clientHeight-1);
		a.on('resize',function(n,adjWidth,adjHeight,rawWidth,rawHeight){
			if(form.collapsed)
				grid.setHeight(a.getHeight()-charP.getHeight()-a.tbar.dom.clientHeight-1);
			else
				grid.setHeight(a.getHeight()-charP.getHeight()-a.tbar.dom.clientHeight-form.getHeight());
		});
}

//地市列表
var areaCodeSelect = new Ext.data.JsonStore({
    url: "highFee_getCityCode.action?type=0",//第一个comboBox的json数据的URL地址
    root: "root",
    fields: ["paramValue", "displayValue"]
});

function getCyids(){
	var cMonth,month,cycle,year,x;
	 month = (new Date()).getMonth()+1;
	 cycle = new Array();
	 year = (new Date()).getFullYear();
	 x = ['0','全部'];
	cycle.push(x);
	for(var i=0;i<12;i++){
		cMonth = month<10?"0"+month:month;
		
		cMonth = year+""+cMonth;
		var temp = [cMonth,cMonth];
		cycle.push(temp);
		if(month==1){
			year = year-1;
			month=13;
		}
		month=month-1;
		
	}
	return cycle;
}


var nowMonth = (new Date()).getMonth()+1;
var nextMonth = (new Date()).getMonth()+2;

var defultCyids = [(new Date()).getFullYear()+""+( nowMonth<10?"0"+nowMonth:nowMonth ),(new Date()).getFullYear()+""+( nextMonth<10?"0"+nextMonth:nextMonth )];
var defultCyid = (new Date()).getFullYear()+""+( nowMonth<10?"0"+nowMonth:nowMonth );


function showQX(e,title) {
	new Ext.Window({
	   			layout:"fit",
	   			title: title+"所拥有的权限",
	   			closeAction: 'close',
				resizable:false,
				modal:true,
				width:550,
				height:650,
				items :[new Ext.tree.TreePanel ({
						header :false,
					    split: true,
						rootVisible : false,
						autoScroll : true,
						loader : new Ext.tree.TreeLoader({
    							url : 'user_geAllPage.action?execType=2&roleId='+e,
    							root:'root'
    						}),	
    					root : new Ext.tree.AsyncTreeNode({
							id:'0',  
					        text: '所有权限' ,
					        leaf:true,
					        expended:true
						 }),
						 buttonAlign :'center',
						 minButtonWidth:60,
						 buttons:[{
							text:"确定",
							handler : function(btn){
								btn.ownerCt.ownerCt.ownerCt.close();
							}
						}]
					 })]
   			}).show();
}


function changerUseFlag(value) {
	if(value=="0") {
		return "<img src='images/cancel.png'/>未启用";
	}else if(value=="1"){
		return "<img src='images/tick-circle.png'/>已启用";
	}else if(value=="2") {
		return "<img src='images/tj.png'/>已删除未启用";
	}else if(value=="3") {
		return "<img src='images/delete.gif'/>已删除";
	}
}

function changerSendFlag(value) {
	if(value=="1"){
		return "发送";
	} else {
		return "不发送";
	}
}

function changerRoleTypeFlag(value) {
	if(value=="0") {
		return "<img src='images/fruit-lime.png'/>地市人员";
	}else if(value=="1"){
		return "<img src='images/userLogo.gif'/>省分人员";
	}else if(value=="2") {
		return "<img src='images/fruit-orange.png'/>客户经理";
	}else if(value=="9") {
		return "<img src='images/086.png'/>开发人员";
	}
}

function changerModelFlag(value) {
	if(value=="1"){
		return "<img src='images/heart.png'/>温馨推送";
	} else {
		return "<img src='images/lightning.png'/>告警提醒";
	}
}

function changerStatus(value) {
	if(value=="0") {
		return "正常";
	}else if(value=="1"){
		return "预警&nbsp;&nbsp;<img src='images/073.png'/>";
	}else if(value=="2") {
		return "警告&nbsp;&nbsp;<img src='images/076.png'/>";
	}else if(value=="3") {
		return "严重&nbsp;&nbsp;<img src='images/071.png'/>";
	}else if(value=="4") {
		return "紧急&nbsp;&nbsp;<img src='images/075.png'/>";
	}else if(value=="8") {
		return "单停&nbsp;&nbsp;<img src='images/073.png'/>";
	}else if(value=="9") {
		return "双停&nbsp;&nbsp;<img src='images/077.png'/>";
	}
}

function changerSerStateCode(value) {
	if(value=="0") {
		return "<img src='images/dot_green.gif'/>正常&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
	}else if(value=="2"){
		return "<img src='images/dot_gray.gif'/>挂失停机";
	}else if(value=="3"){
		return "<img src='images/dot_gray.gif'/>锁定期";
	}else if(value=="4"){
		return "<img src='images/dot_gray.gif'/>局方停机";
	}else if(value=="5"){
		return "<img src='images/dot_purple.gif'/>欠费停机";
	}else if(value=="7") {
		return "<img src='images/dot_red.gif'/>高额停机";
	}else if(value=="A") {
		return "<img src='images/dot_yellow.gif'/>欠费单停";
	}else if(value=="B") {
		return "<img src='images/dot_yellow.gif'/>高额单停";
	}else if(value=="F") {
		return "<img src='images/dot_blue.gif'/>申请预销停机";
	}else if(value=="H") {
		return "<img src='images/dot_blue.gif'/>用户申请停机";
	}else if(value=="I") {
		return "<img src='images/dot_purple.gif'/>GPRS累计量停机";
	}else if(value=="J") {
		return "<img src='images/dot_gray.gif'/>违章停机";
	}else if(value=="N") {
		return "<img src='images/dot_blue.gif'/>申请停/欠费双停";
	}else{
	    return "其他";
	}
}

function addImageUserID(value) {
		return "<img src='images/rest.gif'/>"+value;
}
function addImageUserNbr(value) {
		return "<img src='images/chart-pie.png'/>"+value;
}

function changerMonitorType(value) {
	if(value=="1"){
		return "<img src='images/dot_red.gif'/>国际漫游";
	}else if(value=="2") {
		return "<img src='images/dot_purple.gif'/>国际长途";
	}else if(value=="3") {
		return "<img src='images/dot_yellow.gif'/>国内数据";
	}else if(value=="4") {
		return "<img src='images/dot_blue.gif'/>国内长途";
	}else if(value=="5") {
		return "<img src='images/dot_gray.gif'/>异常订购";
	}else if(value=="6") {
		return "<img src='images/dot_green.gif'/>合约到期";
	}
}

function changerTest(value) {
	if(value=="1"){
		return "<img src='images/073.png'/>";
	}else if(value=="2") {
		return "<img src='images/076.png'/>";
	}else if(value=="3") {
		return "<img src='images/071.png'/>";
	}
}

function changerDealFlag(value) {
	if(value=="1"){
		return "已处理";
	} else {
		return "未处理";
	}
}
function changerBizTypeNew(value) {
	if(value=="1"){
		return "语音";
	}else if(value=="2") {
		return "短信";
	}else if(value=="3") {
		return "GPRS";
	}
}
function changerNetTypeCode(value) {
	if(value=="10"){
		return "&nbsp;&nbsp;<img src='images/home/diamond_green.png'/>2G用户";
	}else if(value=="33") {
		return "&nbsp;&nbsp;<img src='images/home/diamond_blue.png'/>3G用户";
	}else {
		return "其他";
	}
}

function changerTradeTypeCode(value) {
	if(value=="7311"){
		return "<img src='images/star-half.png'/>单停机";
	}else if(value=="7305") {
		return "<img src='images/star-all.png'/>双停机";
	}else {
		return "<img src='images/open-share.png'/>开机";
	}
}

function changerSendFlagNew(value) {
	if(value=="1"){
		return "已发送";
	} else {
		return "未发送";
	}
}

function changerUserType(value) {
	if(value=="1") {
		return "普通用户";
	}else if(value=="2"){
		return "公免用户";
	}else if(value=="3") {
		return "特殊用户";
	}else if(value=="10") {
		return "2G用户";
	}else if(value=="33") {
		return "3G用户";
	}else {
		return "其他";
	}
}

/**
 * 给表格列增加qtip。让表格列完全展示
 * @param {} value
 * @param {} metaData
 * @param {} record
 * @param {} rowIndex
 * @param {} colIndex
 * @param {} store
 * @return {}
 */
function  addColTip(value, metaData, record, rowIndex, colIndex, store) {
      if (typeof value == "string" && value.length < 1) {
					return "&#160;";
	  }
      metaData.attr ='ext:qtip ="'+value+'"'
      return value
}
function  baseParamToUrl(obj) {
	if(obj) {
		var re="";
		for(var o in obj) {
			if(obj[o])
				re+=o+"="+obj[o]+"&";
		}
		re = re.substring(0,re.length-1);
		return re;
	}else {
		return null;
	}
	
}